package com.j.lemon.learn.basic.utils;

/**
 * @Author lijunjun
 * @Date 2018-12-20 18:16
 * @Description
 */
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//


import java.util.HashMap;
import java.util.Map;
import java.util.UUID;

public class SeqUtils {
    public SeqUtils() {
    }

    public static String genSeqId() {
        long curTime = System.currentTimeMillis();
        String time = String.valueOf(curTime);
        if (time.length() > 13) {
            time = time.substring(time.length() - 13);
        }

        String uuid = MD5Utils.encrypt16(UUID.randomUUID().toString()).toUpperCase();
        String random = String.valueOf(curTime % 100L);
        if (random.length() < 2) {
            random = "0" + random;
        }

        return time + "A" + uuid + random;
    }

    public static void main(String[] args) {
        Map<String, Boolean> map = new HashMap();
        StringBuilder stringBuilder = new StringBuilder();
        long start = System.currentTimeMillis();

        for(int i = 0; i < 1000; ++i) {
            stringBuilder.append(genSeqId() + ",");
        }

        long end = System.currentTimeMillis() - start;
        System.out.println("耗时:" + end);
        String[] seqIds = stringBuilder.toString().split(",");
        String[] var8 = seqIds;
        int var9 = seqIds.length;

        for(int var10 = 0; var10 < var9; ++var10) {
            String item = var8[var10];
            if (map.containsKey(item)) {
                System.out.println("contain seqid:" + item);
            } else {
                map.put(item, Boolean.TRUE);
            }
        }

        System.out.println("map size:" + map.keySet().size());
    }
}

